<template>
	<!-- 球馆 statr -->
	<view class="meadowlands">
		<view class="bg1">
			<view></view>
		</view>
		<view class="dian"></view>
		<uv-navbar :placeholder="true" bg-color="transparent" @leftClick="back">
			<image slot="left" src="https://www.guizhouqy.com/mini/back.png" style="width: 48rpx;height: 48rpx;"></image>
			<text slot="center" style="font-weight: bold;font-size: 32rpx;color: #FFFFFF;"></text>
		</uv-navbar>
		<!-- <view class="header">
			<image src="https://www.guizhouqy.com/mini/back.png" mode="" @click="back"></image>
			<text></text>
			<image src="" mode=""></image>
		</view> -->
		<view class="box1">
			<image src="https://www.guizhouqy.com/mini/group.png" mode=""></image>
			<text>支付成功！</text>
		</view>
		<view class="box2">
			<view class="miscellaneous">
				<view class="left">
					<image :src="userInfo.avatar" mode=""></image>
					<view class="sundries">
						<view class="name">{{userInfo.assistant_name}}</view>
						<view class="tip">{{userInfo.signature}}</view>
					</view>
				</view>
				<view class="right">
					{{userInfo.price}}元/分钟
				</view>
			</view>
		</view>
		<view class="box3">
			<view class="title">预约时间：</view>
			<view class="interval">
				<view class="item">{{dataArray.start_time}}</view>
				<text>~</text>
				<view class="item">{{dataArray.end_time}}</view>
			</view>
		</view>
		<view class="box4">
			<view class="item">
				<view class="tip">提示</view>
				<view class="tip1">已支付成功，等待助教确认，</view>
				<view class="tip2">如三小时内未确认，系统将会自动退款</view>
			</view>
		</view>
		<view class="box5">
			<view class="but" @click="switchTab()">我知道了</view>
		</view>
	</view>
	<!-- 球馆 end -->
</template>

<script>
	import {
		goLogin,
		checkLogin
	} from '@/libs/login';
	export default {
		data() {
			return {
				dataArray: {
					start_time: "",
					end_time: ""
				},
				userid: "",
				userInfo: {}
			}
		},
		onShow() {
			let theme = uni.getStorageSync('theme')
			this.fontColor = theme.color
			this.themeBg = 'linear-gradient(90deg, ' + theme.bg1 + ', ' + theme.bg2 + ')'
			this.isLogin = this.$store.getters.isLogin
		},
		onLoad(options) {
			console.log(options.id)
			this.userid = options.userid
			this.getOrderInfo(options.id)
		},
		methods: {
			switchTab() {
				uni.switchTab({
					url: '/pages/my/index'
				})
			},
			async getOrderInfo(order_sn) {
				console.log("order_sn", order_sn)
				uni.showLoading({
					title: '请稍后'
				})
				let res = await this.$api.meadowlands.orderInfo.post({
					order_sn: order_sn
				})
				uni.hideLoading()
				if (res.code == 0) {
					this.dataArray.start_time = res.data.info.appointment_start_time;
					this.dataArray.end_time = res.data.info.appointment_end_time;
					this.getData()
				} else {
					this.$tool.error(res.msg);
				}
			},
			async getData() {
				let res = await this.$api.meadowlands.getAssistantDetails.get({
					user_id: this.userid
				})
				uni.hideLoading()
				if (res.code == 0) {
					this.userInfo = res.data
					console.log(res.data)
				} else {
					this.$tool.error(res.msg);
				}
			},
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			navTo(url) {
				console.log("url", url)
				uni.navigateTo({
					url
				})
				return
				if (!this.isLogin) {
					goLogin();
				}


			},
		}
	}
</script>

<style scoped lang="scss">
	.meadowlands {
		background: #240F41;
		color: #FFFFFF;
		min-height: 100vh;

		.bg1 {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			position: absolute;
			left: calc(50%-59px);

			view {
				width: 118px;
				height: 118px;
				background: linear-gradient(90deg, #C829F3 0%, #4516CA 100%);
				box-shadow: inset 0rpx 8rpx 8rpx 0rpx rgba(0, 0, 0, 0.25);
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				opacity: 0.9;
				filter: blur(90px);
			}
		}

		.dian {
			width: 118px;
			height: 118px;
			background: linear-gradient(90deg, #1F87EF 0%, #1F87EF 100%);
			box-shadow: inset 0rpx 8rpx 8rpx 0rpx rgba(0, 0, 0, 0.25);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			opacity: 0.9;
			filter: blur(90px);
			position: absolute;
			left: 0;
			top: 20px;
		}

		.header {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			padding: 0 38rpx;
			padding-top: 30px;

			image {
				width: 48rpx;
				height: 48rpx;
				z-index: 999;
			}
		}

		.box1 {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			margin-top: 62rpx;

			image {
				width: 436rpx;
				height: 436rpx;
			}

			text {
				font-size: 40rpx;
				font-weight: bold;
				color: #FFFFFF;
				margin-top: 32rpx;
			}
		}

		.box2 {
			padding: 0 26rpx;
			z-index: 999;
			margin-top: 126rpx;

			.miscellaneous {
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 62rpx;
				width: 100%;
				height: 160rpx;
				background: linear-gradient(180deg, #9A24B9 0%, #7116E9 100%);
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				border: 2rpx solid #9A24B9;
				margin-top: 24rpx;

				.left {
					display: flex;
					flex-direction: row;
					align-items: center;
					padding-left: 34rpx;

					image {
						width: 96rpx;
						height: 96rpx;
						border-radius: 116rpx 116rpx 116rpx 116rpx;
						border: 4rpx solid #9A24B9;
						border-radius: 50%;
					}

					.sundries {
						margin-left: 26rpx;

						.name {
							font-weight: bold;
							font-size: 32rpx;
							color: #FFFFFF;
						}

						.tip {
							font-weight: bold;
							font-size: 24rpx;
							color: #999999;
							margin-top: 8rpx;
						}
					}
				}

				.right {
					padding-right: 28rpx;
					font-weight: 500;
					font-size: 32rpx;
					color: #FFFFFF;
				}
			}
		}

		.box3 {
			padding: 0 26rpx;

			.title {
				font-weight: bold;
				font-size: 28rpx;
				color: #FFFFFF;
				margin-top: 28rpx;
			}

			.interval {
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-top: 28rpx;

				.item {
					width: fit-content;
					height: 48rpx;
					background: linear-gradient(180deg, #9A24B9 0%, #7116E9 100%);
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					border: 2rpx solid #9A24B9;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
					padding: 0 20rpx;
				}

				text {
					margin: 0 32rpx;
				}
			}
		}

		.box4 {
			padding: 0 26rpx;
			margin-top: 48rpx;

			.item {
				width: 100%;
				height: 256rpx;
				background: linear-gradient(180deg, #9A24B9 0%, #7116E9 100%);
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				border: 2rpx solid #9A24B9;

				.tip {
					text-align: center;
					padding-top: 52rpx;
					font-size: 32rpx;
					color: #fff;
					font-weight: bold;
				}

				.tip1 {
					text-align: center;
					font-weight: bold;
					font-size: 28rpx;
					color: #fff;
					margin-top: 28rpx;
				}

				.tip2 {
					text-align: center;
					font-weight: bold;
					font-size: 28rpx;
					color: #fff;
				}
			}
		}

		.box5 {
			padding: 0 24rpx;
			margin-top: 54rpx;
			padding-bottom: 40rpx;

			.but {
				width: 100%;
				height: 80rpx;
				background: linear-gradient(313deg, #7116E9 0%, #15D1E2 100%);
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: center;
			}
		}
	}
</style>